﻿using System;
using System.Collections.Generic;
using System.Text;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Math;
namespace Xeno.Core
{

    public class XuiWidget : XenoModule
    {
        
        public Vector3 Size { get; set; }
        
        public XuiWidget(Vector2 size)
        {

            Size = new Vector3(size.X, size.Y,0);


        }

        public static void Begin2D()
        {
            GL.PushAttrib(AttribMask.AllAttribBits);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            Matrix4 projectionMatrix = Matrix4.CreateOrthographicOffCenter(0, XenoCore.DisplayWidth, XenoCore.DisplayHeight, 0, 0, 2);

            GL.LoadMatrix(ref projectionMatrix);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();


            GL.Disable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.Disable(EnableCap.AlphaTest);
            GL.Disable(EnableCap.ScissorTest);

            GL.DepthMask(false);
        }
        public static void End2D()
        {
            GL.PopAttrib();
        }

    }

}
